package ExamplePackage;
import java.sql.*;
import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;


public class ConnectionManager {
    
    static Connection con;
	static String url;
        
    
    public static Connection getConnection()
    {
        
        try
        {
        	Context ctx = new InitialContext();
                DataSource ds = (DataSource) ctx.lookup("jdbc/login");

            
            try
            {            	
                 con = ds.getConnection();                										// Assuming your SQL Server's	username is "username"
                										// And password is "password"
                 
            }
            
            catch (SQLException ex)
            {
                ex.printStackTrace();
            }
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
        return con;
    }

}
